package com.vf.admin.client.dao;

import com.vf.admin.common.db.BaseDao;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.AppQianDaoRecord;
import com.vf.admin.miaodong.entity.AppSignConfig;
import com.vf.admin.utils.StringEx;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Repository
public class AppSignConfigDao extends BaseDao<AppSignConfig> {

    public List<AppSignConfig> list() {
        StringBuilder sbStr = new StringBuilder("select * from app_sign_config");
        String sql = sbStr.toString();
        return this.queryList(sql, new ArrayList<>(), AppSignConfig.class);
    }

    public AppSignConfig infoByDay(Integer day) {
        ArrayList<Object> paramList = new ArrayList<>();
        StringBuilder sbStr = new StringBuilder("select * from app_sign_config where day = ? limit 1");
        paramList.add(day);
        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, AppSignConfig.class);
    }

    public AppSignConfig infoByDayAndId(Integer day, Integer id) {
        ArrayList<Object> paramList = new ArrayList<>();
        StringBuilder sbStr = new StringBuilder("select * from app_sign_config where day = ? and id != ?");
        paramList.add(day);
        paramList.add(id);
        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, AppSignConfig.class);
    }

    public List<AppSignConfig> findList(SplitPageBean splitPageBean) {
        List<Object> list = new ArrayList<>();
        StringBuilder str = new StringBuilder("");
        str.append("select * from app_sign_config where 1=1 ");

        str.append(" order by day asc ");
        String sql = str.toString();
        return this.queryList(sql, list, AppSignConfig.class, splitPageBean);
    }

    public AppSignConfig info(Integer id) {
        ArrayList<Object> paramList = new ArrayList<>();
        StringBuilder sbStr = new StringBuilder("select * from app_sign_config where id = ?");
        paramList.add(id);
        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, AppSignConfig.class);
    }
}
